/*
 * Created by XiaoDongLei
 * Copyright (c) 2017-2017
 * Apache License
 * Version 2.0, January 2004
 * http://www.apache.org/licenses/
 *
 *
 *
 */
package com.vonzhou.springinaction.knights.config;

import com.vonzhou.springinaction.knights.BraveKnight;
import com.vonzhou.springinaction.knights.Knight;
import com.vonzhou.springinaction.knights.Quest;
import com.vonzhou.springinaction.knights.SlayDragonQuest;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author XiaoDongLei
 * @Package com.vonzhou.springinaction.knights
 * @date 2018/3/24
 * @Description: Spring提供了基于Java的配置，可作为XML的替代方案。
 * 该类展现了基于Java的配置，它的功能与使用knights-aop.xml相同。
 */
@Configuration
public class KnightConfig {

	@Bean
	public Knight knight() {
		return new BraveKnight(quest());
	}

	@Bean
	public Quest quest() {
		return new SlayDragonQuest(System.out);
	}
}
